<?php 
/**
 * TomatoCMS
 * 
 * LICENSE
 *
 * This source file is subject to the GNU GENERAL PUBLIC LICENSE Version 2 
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.gnu.org/licenses/gpl-2.0.txt
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@tomatocms.com so we can send you a copy immediately.
 * 
 * @copyright	Copyright (c) 2009-2010 TIG Corporation (http://www.tig.vn)
 * @license		http://www.gnu.org/licenses/gpl-2.0.txt GNU GENERAL PUBLIC LICENSE Version 2
 * @version 	$Id: show.phtml 5129 2010-08-30 04:36:55Z huuphuoc $
 * @since		2.0.0
 */
?>
<div class="t_news_categories">
<?php if ($this->categories != null) : ?>
	<?php foreach ($this->categories as $index => $category) : ?>
	<div class="clearfix">
		<h2>
			<a id="<?php echo $category->category_id; ?>" href="<?php echo $this->url($category->getProperties(), 'news_article_category'); ?>"><?php echo $category->name; ?></a>
			
			<?php if ($subCats = $this->helper()->getSubCategories($category->category_id)) : ?>
			<?php foreach ($subCats as $subCat) : ?>
			/ <a id="<?php echo $subCat->category_id; ?>" href="<?php echo $this->url($subCat->getProperties(), 'news_article_category'); ?>"><?php echo $subCat->name; ?></a>
			<?php endforeach; ?>
			<?php endif; ?>
			
			<a class="rss" href="<?php echo $this->url($category->getProperties(), 'news_rss_category'); ?>">&nbsp;</a>
		</h2>
		
		<div>
			<?php if (($articles = $this->helper()->getLatestArticles($category->category_id, $this->limit)) != null && count($articles) > 0) : ?>
			<ul>
			<?php foreach ($articles as $index => $article) : ?>
				<li>
					<h3>
						<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>"><?php echo $article->title; ?></a>
						<?php echo $this->articleIcons($article->icons); ?>
						<cite><?php echo date($this->globalConfig('web')->datetime->format->datetime, strtotime($article->activate_date)); ?></cite>
					</h3>
					
					<?php if ($article->image_small) : ?>
					<a href="<?php echo $this->url($article->getProperties(), 'news_article_details'); ?>">
						<img src="<?php echo $article->image_small; ?>" />
					</a>
					<?php endif; ?>
					
					<div class="description"><?php echo $article->description; ?></div>
					<div class="clearfix"></div>
				</li>
			<?php endforeach; ?>
			</ul>
			
			<div class="clear"></div>
			<?php endif; ?>
		</div>
	</div>
	<?php endforeach; ?>
<?php endif; ?>	
</div>
